package com.guodexian.xiaomi.vo;


import lombok.Data;

/**
 * 类说明：  <br>
 *
 * @author 南阳德刚<br>
 * 2024-12-30 14:53<br>
 * @since 1.0 <br>
 * 培养IT高薪技术人才的摇篮---北京学佳澳。<br>
 * 点击<a href="http://www.xuejiaao.com/images/qrcode.jpg">学佳澳教育</a>关注公共号,有惊喜(⊙o⊙)<br>
 */

// 自动创建属性 getter和 setter方法

@Data
public class ResultVO <T> {
    private int code;
    // 错误消息
    private String msg;
    private T data;
    private long count;
    private ResultVO(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
    private ResultVO(int code, String msg, T data, long count) {
        this(code, msg, data);
        this.count = count;
    }
    public static <T> ResultVO<T> success(T data) {
        return new ResultVO<T>(0, "success", data);
    }

    public static <T> ResultVO<T> success(T data, long count) {
        return new ResultVO<T>(0, "success", data, count);
    }

    public static <T> ResultVO<T> fail(String msg) {
        return new ResultVO<T>(200, msg, null);
    }
}